import { getStringByName } from './resource_manager/ResourceManager';

const FolderNameMaxLength = 50

/**
 * 返回errormessage
 * @param content
 * @returns
 */
export function verifySpecialCharactor(content: string): string {
  if (content.length == 0) return getStringByName("please_input_folder_name")
  // ]需要加一个\\
  let exp2 :RegExp = /[%":\\/*?<>|=,^']/g;
  let invalidIndex = content.search(exp2);
  if (invalidIndex != -1) {
    return getStringByName("invalid_folder_name");
  }
  if (content.length > FolderNameMaxLength) {
    return getStringByName("can_not_exceed_max_chars", FolderNameMaxLength);
  }
  return ""
}